package net.sx.minemodule.mvp.fragments;


import android.os.Bundle;
import android.view.View;

import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.dialog.ECAlertDialog;
import com.kedll.library.fragment.KRefreshListFragment;
import com.kedll.library.util.ToastUtil;

import net.sx.minemodule.MineApiUtils;
import net.sx.minemodule.R;
import net.sx.minemodule.databinding.MineFragmentMineGoodCollectBinding;
import net.sx.minemodule.mvp.bean.GoodCollectBean;
import net.sx.minemodule.mvp.item.GoodCollectItem;
import net.sx.minemodule.mvp.presenters.MineGoodCollectPresenter;


/**
 * 商品收藏
 *
 * @author 11470
 */
public class MineGoodCollectFragment extends KRefreshListFragment<MineFragmentMineGoodCollectBinding, MineGoodCollectPresenter> {

    @Override
    protected void initEvent(Bundle savedInstanceState) {
        super.initEvent(savedInstanceState);
        adapter.setOnItemClickListener((MultiTypeAdapter.OnItemClickListener<GoodCollectBean>) (v, iItem) -> {
            ToastUtil.showToast("点击了");
        });
        adapter.setOnItemLongClickListener((MultiTypeAdapter.OnItemLongClickListener<GoodCollectBean>) (v, iItem) -> {
            ToastUtil.showToast("长按点击了");
            ECAlertDialog dialog = ECAlertDialog.buildAlert(v.getContext(), "确定删除?", (dialog1, which) -> {
                getPresenter().removeGoodsItem((GoodCollectItem) iItem);
            });
            dialog.show();
        });
    }

    @Override
    protected MineGoodCollectPresenter getPresenter() {
//        return new MineGoodCollectPresenter(this);
        return null;
    }

    @Override
    protected int getLayout() {
        return R.layout.mine_fragment_mine_good_collect;
    }
}
